package com.ruoyi.yf.test.http;

import java.util.concurrent.BlockingQueue;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

import com.ruoyi.yf.test.http.Constants;
import com.ruoyi.yf.test.http.PageThread;
import com.ruoyi.yf.test.http.WebUtils;

/**
*
*作者:yellowcong
*日期:2017/11/24
*時間:10:20:17
*描述:
*/
public class Main {

    public static void main(String[] args) throws Exception {

        //获取队列信息
        BlockingQueue<String> queue = WebUtils.getPageInfo(Constants.HOME_URL);

        //创建一个线程池
        int poolSize =8;
        ExecutorService pool = Executors.newFixedThreadPool(poolSize);

        //提交任务
        //获取线程
        PageThread thread = new PageThread(queue);
        for(int i=0;i<poolSize;i++) {
            //提交任务
            pool.submit(thread);
        }

        pool.shutdown();
    }
}